<template>
    <div>
      <!-- <Search :search="search" :reset="reset" :inline="true">
        <template v-slot:body>
          <el-form-item label="检验单号" prop="inspectionnumber" maxlength="5">
            <el-input v-model="query.inspectionnumber" name="inspectionnumber" clearable />
          </el-form-item>
          <el-form-item label="暂收单号" prop="ordernumber" maxlength="5">
            <el-input v-model="query.ordernumber" name="ordernumber" clearable />
          </el-form-item>
          <el-form-item label="品号" prop="fmaterialid" maxlength="5">
            <el-input v-model="query.fmaterialid" name="fmaterialid" clearable />
          </el-form-item>
          <el-form-item label="合格状态" prop="inspectionresult">
            <el-select v-model="query.inspectionresult" placeholder="请选择" clearable>
              <el-option label="合格" value="0" />
              <el-option label="不合格" value="1" />
              <el-option label="全部" value="" />
            </el-select>
          </el-form-item>
        </template>
      </Search> -->
      <div class="table-default" style="padding-top: 10px">
        <el-table :data="tableData" class="mt-3" v-loading="loading" border >
          <el-table-column prop="fbillno" label="采购单号" min-width="270" />
          <el-table-column prop="supplierOrder" label="供应商送货单" min-width="230" />
          <el-table-column prop="ordernumber" label="暂收单号" min-width="230" />
          <el-table-column prop="inspectionnumber" label="检验单号" min-width="230" />
          <el-table-column prop="fmaterialid" label="品号" min-width="250" />
          <el-table-column prop="description" label="检验状态" min-width="120">
            <template #default="scope">
              <el-tag class="ml-2" type="warning" v-if="scope.row.state == '0'">{{ scope.row.description }}</el-tag>
              <el-tag class="ml-2" type="success" v-else>{{ scope.row.description }}</el-tag>
            </template>
          </el-table-column>
          <!-- <el-table-column prop="creator_id" label="创建人" min-width="150" /> -->
          <el-table-column prop="created_at" label="创建时间" min-width="150" />
          <el-table-column prop="updated_at" label="更新时间" min-width="150" />
  
          <el-table-column label="操作" fixed="right" width="90">
            <template #default="scope">
              <!-- <router-link :to="{ path: '/purchasing/inspectionlistDetail', query: { id: `${scope.row.id}` } }"> -->
              <router-link :to="{ path: '/purchasing/unqualifiedreturnIndex2', query: { id: `${scope.row.provisional_id}` } }">
                <show />
              </router-link>
              <!-- <span v-if="scope.row.state == 0" class="spanClass" style="margin: 20px 0">
                  <Destroy @click="destroy(api, scope.row.id)" />
                </span> -->
            </template>
          </el-table-column>
        </el-table>
        <Paginate />
      </div>
  
      <!-- <Dialog v-model="visible" :title="title" destroy-on-close>
        <Create @close="close(reset)" :primary="id" :api="api" />
      </Dialog> -->
    </div>
  </template>
  
  <script lang="ts" setup>
  import { computed, onMounted, ref } from 'vue'
  import Create from './create.vue'
  import { useGetList } from '/admin/composables/curd/useGetList'
  import { useDestroy } from '/admin/composables/curd/useDestroy'
  import { useOpen } from '/admin/composables/curd/useOpen'
  import http from '/admin/support/http'
  import { ElMessage } from 'element-plus'
  import { ArrowDownBold, ArrowUpBold } from '@element-plus/icons-vue'
  import { setTableHeight } from '/admin/utils/setHeight.js'
  
  const api = 'purchasing/indexList?decision=0'
  
  const { data, query, search, reset, loading } = useGetList(api)
  const { destroy, deleted } = useDestroy()
  const { open, close, title, visible, id } = useOpen()
  
  const tableData = computed(() => data.value?.data)
  // query.value.inspectionresult ='1'
//   // 审批
//   const approveHandler = id => {
//     http.put(`/purchasing/examinePda/${id}`).then(r => {
//       // console.log(r.data.code);
//       ElMessage({
//         message: r.data.message,
//         type: 'success',
//       })
//       search()
//     })
//   }
  
  let isMore = ref(true)
  
  let getMore = () => {
    isMore.value = !isMore.value
  }
  
  
  onMounted(() => {
    search()
    deleted(reset)
    setTableHeight('.table-default')
  })
  </script>
  
  
  <style>
  .search-hidden {
    height: 100px;
    overflow: hidden;
  }
  
  .spanClass .el-button + .el-button {
    margin-left: 0;
  }
  
  .el-button--small {
    margin-bottom: 5px;
  }
  .el-table {
    height: 87%;
  }
  </style>
  
  